<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="12" style="padding-left: 20px">
        <h2>健身房管理系统</h2>
        <p>
          想要一个完美的身体吗？
        </p>
      </el-col>
    </el-row>
    <el-divider />
    <el-row :gutter="20" class="schedule-section">
      <el-col :span="24">
        <el-card shadow="hover">
          <div slot="header" class="clearfix">
            <span class="schedule-title">当日课程时间表</span>
          </div>
          <el-table
            :data="timetable"
            stripe
            style="width: 100%; margin-top: 10px"
            :default-sort = "{prop: 'time', order: 'ascending'}"
          >
            <el-table-column prop="name" label="课程名称" width="180"/>
            <el-table-column prop="time" label="时间" sortable width="120"/>
            <el-table-column prop="coach" label="教练" width="120"/>
            <el-table-column prop="location" label="场地"/>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
    <el-row :gutter="20" class="service-section">
      <el-col :span="24">
        <h3 class="section-title">特色服务推荐</h3>
      </el-col>
      <el-col :xs="24" :sm="12" :md="8" :lg="6" v-for="(item, index) in services" :key="index">
        <el-card class="service-card" shadow="hover">
          <img :src="item.img" class="service-image"/>
          <div class="service-info">
            <h4 class="service-title">{{ item.title }}</h4>
            <p class="service-desc">{{ item.description }}</p>
            <div class="service-footer">
              <span class="service-price">¥{{ item.price }}</span>
              <el-button type="primary" size="mini" @click="handleBook(item)">立即预约</el-button>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>联系信息</span>
          </div>
          <div class="body">
            <p>
              <i class="el-icon-s-promotion"></i> 官网：<el-link
                href="http://www.xujiakai.cn"
                target="_blank"
                >http://www.example.com</el-link
              >
            </p>
            
            <p>
              <i class="el-icon-chat-dot-round"></i> 微信：<a
                href="javascript:;"
                >16680282787</a
              >
            </p>
            <p>
              <i class="el-icon-money"></i> 支付宝：<a
                href="javascript:;"
                class="支付宝信息"
                >16680280787</a
              >
            </p>
          </div>
        </el-card>
      </el-col>
      <el-col :sm="24" :lg="12" style="padding-right: 20px">
        <el-card class="stats-card">
          <div class="card-header">
            <svg-icon icon-class="dashboard" class="card-icon"/>
            <span class="card-title">今日实时数据</span>
          </div>
          <el-row :gutter="20" class="stats-content">
            <el-col :span="12">
              <div class="stat-item">
                <span class="label">当前在馆人数</span>
                <count-to :start-val="0" :end-val="86" :duration="2000" class="value"/>
              </div>
              <div class="stat-item">
                <span class="label">今日课程预约</span>
                <count-to :start-val="0" :end-val="45" :duration="2200" class="value"/>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="stat-item">
                <span class="label">器材使用率</span>
                <el-progress :percentage="75" status="success" :show-text="false"/>
              </div>
              <div class="stat-item">
                <span class="label">私教预约率</span>
                <el-progress :percentage="90" status="warning" :show-text="false"/>
              </div>
            </el-col>
          </el-row>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {
      version: "3.8.9",
      timetable: [
        { name: '晨间瑜伽', time: '07:00', coach: '王教练', location: '瑜伽室A' },
        { name: '搏击训练', time: '09:30', coach: '李教练', location: '拳击场' },
        { name: '力量训练', time: '14:00', coach: '张教练', location: '器械区' },
        { name: '有氧舞蹈', time: '18:30', coach: '陈教练', location: '舞蹈室B' }
      ],
      services: [
        {
          title: '增肌塑形课程',
          description: '专业教练指导，12周系统训练',
          price: 2999,
          img: require('@/assets/images/gym/c1.png')
        },
        {
          title: '瑜伽普拉提',
          description: '缓解压力，改善体态',
          price: 1999,
          img: require('@/assets/images/gym/c2.png')
        },
        {
          title: '拳击训练营',
          description: '提升爆发力，专业搏击指导',
          price: 3599,
          img: require('@/assets/images/gym/c3.png')
        }
      ]
    };
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },
    handleBook(item) {
      this.$message.success(`已预约 ${item.title} 课程`);
      // 这里可以添加实际预约逻辑
      console.log('预约信息:', item);
    }
  }
};
</script>

<style scoped lang="scss">
.service-card {
  position: relative;
  overflow: hidden;
}
.service-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.3s ease;
}
.service-image:hover {
  transform: scale(1.05);
}
.home {
  .service-card {
    position: relative;
    overflow: hidden;
  }
  .service-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.3s ease;
  }
  .service-image:hover {
    transform: scale(1.05);
  }
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }
.schedule-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--el-text-color-primary);
}
.schedule-section {
  margin-bottom: 20px;
}
.el-table .cell {
  padding: 8px 10px;
}
  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>

